﻿using System.Collections;
using System.Collections.Generic;
using System;
using System.Text;

using System.IO;
using System.Data;
using System.Xml;
using System.Web.Security;
using System.Security.Cryptography;
using System.Net;
using System.Web;

using com.paypal.sdk.profiles;
namespace Gift.WebApp
{

    /// <summary>
    ///SetProfile 的摘要说明
    /// </summary>
    public class SetProfile
    {
        // Fields
        public static readonly IAPIProfile DefaultProfile = CreateAPIProfile(Constants.API_USERNAME, Constants.API_PASSWORD, Constants.API_SIGNATURE, "", "", "sandbox", "", "", "", "");

        // Methods
        public static IAPIProfile CreateAPIProfile(string apiUsername, string apiPassword, string signature, string CertificateFile_Cer, string PrivateKeyPassword_Cer, string stage, string subject, string oauth_Signature, string oauth_Token, string oauth_Timestamp)
        {
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            profile.APIUsername = apiUsername;
            profile.APIPassword = apiPassword;
            profile.Environment = stage;
            profile.Subject = subject;
            profile.APISignature = signature;
            return profile;
        }

        public static void SetDefaultProfile()
        {
            SessionProfile = DefaultProfile;
        }

        // Properties
        public static IAPIProfile SessionProfile
        {
            get
            {
                return (IAPIProfile)HttpContext.Current.Session["Profile"];
            }
            set
            {
                HttpContext.Current.Session["Profile"] = value;
            }
        }

    }
}